from fastapi import APIRouter, Header
from src.models import VersionResponse
from starlette import status

from src import settings
from src.enums.exception import ExceptionEnum
from src.exceptions import ResponseException

async def verify_token(token: str = Header(...)):
    if token != settings.API_TOKEN:
        raise ResponseException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            error= ExceptionEnum.INVALID_TOKEN
        )
    return token
router = APIRouter()
@router.get("/",)
async def root():
    return "Hello! This is Waybill Crawler API Server!"

@router.get("/version", response_model=VersionResponse)
async def get_version():
    return VersionResponse(
        version=settings.VERSION_INFO,
        release_date=settings.VERSION_RELEASE_DATE
    )

